package com.lovo.view;

import com.lovo.javafxComponent.LovoImage;
import com.lovo.javafxComponent.LovoPassword;
import com.lovo.javafxComponent.LovoTxt;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;

/**
 * 登陆页面
 * @author lenovo
 *
 */
public class LoginView extends Pane{
	/**登陆文本框*/
	private LovoTxt nameTxt;
	/**密码框*/
	private LovoPassword pwdTxt;
	/**主容器*/
	private BorderPane root;
	/**
	 * 构造方法
	 * @param root 根容器
	 */
	public LoginView(BorderPane root) {
		this.root = root;
		
		this.initComponent();
		
		root.setCenter(this);
	}
	
	/**
	 * 初始化组件
	 */
	private void initComponent() {
		new LovoImage("image/back.png", 0, 0, 1000, 700, this);
		nameTxt = new LovoTxt(340,280,"image/user.png",this);
		nameTxt.setText("joden");
		pwdTxt = new LovoPassword(340,360,"image/pwd.png",this);
		pwdTxt.setText("555");

		LovoImage loginImg = new LovoImage("image/login.png", 440, 450, 60, 60, this);
		loginImg.setOnMouseClicked(e -> login());
	}

	//--------------------------------------------------
	/**
	 * 登陆方法
	 */
	private void login() {
		//登陆验证

		//切换界面
		new MainView(root);
	}
}
